<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var p = parseInt(prompt("输入一个三位数判断是不是水仙花数"));
      var a = p % 10;
      var b = parseInt((p % 100) / 10);
      var c = parseInt(p / 100);
      var m = a * a * a + b * b * b + c * c * c;
      //   document.write(m);
      if (p === m) {
        document.write("是水仙花数");
      } else document.write("不是水仙花数");
    </script>
  </body>
</html>
